package javolution.util;

import java.util.logging.Level;
import java.util.logging.LogRecord;
import java.util.logging.Logger;
import javolution.Javolution;
import javolution.context.LogContext;

/* loaded from: classes2.dex */
public class StandardLog extends LogContext {
    private Logger _logger;

    public StandardLog() {
        this(Logger.getLogger(""));
    }

    public StandardLog(Logger logger) {
        this._logger = logger;
    }

    public static void config(String str) {
        LogContext current = LogContext.getCurrent();
        if (current instanceof StandardLog) {
            ((StandardLog) current)._logger.config(str);
        }
    }

    public static void entering(String str, String str2) {
        LogContext current = LogContext.getCurrent();
        if (current instanceof StandardLog) {
            ((StandardLog) current)._logger.entering(str, str2);
        }
    }

    public static void exiting(String str, String str2) {
        LogContext current = LogContext.getCurrent();
        if (current instanceof StandardLog) {
            ((StandardLog) current)._logger.exiting(str, str2);
        }
    }

    public static void fine(String str) {
        LogContext current = LogContext.getCurrent();
        if (current instanceof StandardLog) {
            ((StandardLog) current)._logger.fine(str);
        }
    }

    public static void finer(String str) {
        LogContext current = LogContext.getCurrent();
        if (current instanceof StandardLog) {
            ((StandardLog) current)._logger.finer(str);
        }
    }

    public static void finest(String str) {
        LogContext current = LogContext.getCurrent();
        if (current instanceof StandardLog) {
            ((StandardLog) current)._logger.finest(str);
        }
    }

    public static boolean isLoggable(Level level) {
        LogContext current = LogContext.getCurrent();
        if (current instanceof StandardLog) {
            return ((StandardLog) current)._logger.isLoggable(level);
        }
        if (level.intValue() >= Level.WARNING.intValue()) {
            return current.isWarningLogged();
        }
        if (level.intValue() >= Level.INFO.intValue()) {
            return current.isInfoLogged();
        }
        return false;
    }

    public static void log(LogRecord logRecord) {
        LogContext current = LogContext.getCurrent();
        if (current instanceof StandardLog) {
            ((StandardLog) current)._logger.log(logRecord);
            return;
        }
        Throwable thrown = logRecord.getThrown();
        if (thrown != null) {
            if (current.isErrorLogged()) {
                current.logError(thrown, Javolution.j2meToCharSeq(logRecord.getMessage()));
            }
        } else if (logRecord.getLevel().intValue() > Level.WARNING.intValue()) {
            if (current.isWarningLogged()) {
                current.logWarning(Javolution.j2meToCharSeq(logRecord.getMessage()));
            }
        } else if (logRecord.getLevel().intValue() <= Level.INFO.intValue() || !current.isInfoLogged()) {
        } else {
            current.logInfo(Javolution.j2meToCharSeq(logRecord.getMessage()));
        }
    }

    public static void severe(String str) {
        LogContext current = LogContext.getCurrent();
        if (current instanceof StandardLog) {
            ((StandardLog) current)._logger.severe(str);
        } else if (current.isWarningLogged()) {
            current.logWarning(Javolution.j2meToCharSeq(str));
        }
    }

    public static void throwing(String str, String str2, Throwable th) {
        LogContext current = LogContext.getCurrent();
        if (current instanceof StandardLog) {
            ((StandardLog) current)._logger.throwing(str, str2, th);
        } else if (current.isErrorLogged()) {
            current.logError(th, (CharSequence) null);
        }
    }

    public final Logger getLogger() {
        return this._logger;
    }

    @Override // javolution.context.LogContext
    public boolean isErrorLogged() {
        return this._logger.isLoggable(Level.SEVERE);
    }

    @Override // javolution.context.LogContext
    public boolean isInfoLogged() {
        return this._logger.isLoggable(Level.INFO);
    }

    @Override // javolution.context.LogContext
    public boolean isWarningLogged() {
        return this._logger.isLoggable(Level.WARNING);
    }

    @Override // javolution.context.LogContext
    public void logError(Throwable th, CharSequence charSequence) {
        String obj = charSequence != null ? charSequence.toString() : "";
        if (th != null) {
            this._logger.log(Level.SEVERE, obj, th);
        } else {
            this._logger.log(Level.SEVERE, obj);
        }
    }

    @Override // javolution.context.LogContext
    public void logInfo(CharSequence charSequence) {
        this._logger.info(charSequence.toString());
    }

    @Override // javolution.context.LogContext
    public void logWarning(CharSequence charSequence) {
        this._logger.warning(charSequence.toString());
    }
}
